<?php
/**
 * Created by PhpStorm.
 * User: Guangpeng Chen
 * Date: 12/11-011
 * Time: 16:53
 */
include_once '/var/www/html/new/d/module/common/Db.class.php';
include_once '/var/www/html/new/d/class/SoapInit.class.php';
$dbConf = include '/var/www/html/new/d/module/common/db.conf.php';// 远端服务器配置信息
$soap = SoapInit::GetSoapInside();

\PFT\Db::Conf($dbConf['localhost']);
$db = \PFT\Db::Connect();

$sql = "select u.code,u.salerid,l.terminal from uu_ss_order u left join uu_land l ON l.id=u.lid where u.ordertime>'2015-12-11 16:10:15' order by code asc";
$stmt = $db->prepare($sql);
$stmt->execute();
$output = [];
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    $output[$row['salerid']][] = array(
        'code'      =>str_pad($row['code'],'6','0'),
        'salerid'   =>$row['salerid'],
        'terminal'  =>$row['terminal'],
    );
}
foreach ($output as $salerid=>$item) {
    file_put_contents("/var/log/web/data_{$salerid}.inc.php", "<?php\nreturn " . var_export($item, true).";");
}